//
//  RSIDAuth.h
//  StaffTax
//
//  Created by 侯伟 on 2020/4/3.
//  Copyright © 2020 侯伟. All rights reserved.
//  本地认证

#import <Foundation/Foundation.h>

/**
 *  TouchID/FaceID 状态
 */
typedef NS_ENUM(NSUInteger, RSIDAuthState){
    
    /**
     *  当前设备不支持TouchID/FaceID
     */
    RSIDAuthStateNotSupport = 0,
    /**
     *  TouchID/FaceID 验证成功
     */
    RSIDAuthStateSuccess = 1,
    
    /**
     *  TouchID/FaceID 验证失败
     */
    RSIDAuthStateFail = 2,
    /**
     *  TouchID/FaceID 被用户手动取消
     */
    RSIDAuthStateUserCancel = 3,
    /**
     *  用户不使用TouchID/FaceID,选择手动输入密码
     */
    RSIDAuthStateInputPassword = 4,
    /**
     *  TouchID/FaceID 被系统取消 (如遇到来电,锁屏,按了Home键等)
     */
    RSIDAuthStateSystemCancel = 5,
    /**
     *  TouchID/FaceID 无法启动,因为用户没有设置密码
     */
    RSIDAuthStatePasswordNotSet = 6,
    /**
     *  TouchID/FaceID 无法启动,因为用户没有设置TouchID/FaceID
     */
    RSIDAuthStateTouchIDNotSet = 7,
    /**
     *  TouchID/FaceID 无效
     */
    RSIDAuthStateTouchIDNotAvailable = 8,
    /**
     *  TouchID/FaceID 被锁定(连续多次验证TouchID/FaceID失败,系统需要用户手动输入密码)
     */
    RSIDAuthStateTouchIDLockout = 9,
    /**
     *  当前软件被挂起并取消了授权 (如App进入了后台等)
     */
    RSIDAuthStateAppCancel = 10,
    /**
     *  当前软件被挂起并取消了授权 (LAContext对象无效)
     */
    RSIDAuthStateInvalidContext = 11,
    /**
     *  系统版本不支持TouchID/FaceID (必须高于iOS 8.0才能使用)
     */
    RSIDAuthStateVersionNotSupport = 12
};

NS_ASSUME_NONNULL_BEGIN

@interface RSIDAuth : NSObject

typedef void (^RSIDAuthStateBlock)(RSIDAuthState state, NSError* _Nullable error);

/**
 * 启动TouchID/FaceID进行验证
 * @param describe TouchID/FaceID显示的描述
 * @param complete 回调状态的block
 */
+ (void)authIDWithDescribe:(NSString *)describe complete:(RSIDAuthStateBlock)complete;

@end

NS_ASSUME_NONNULL_END
